/**
 * 配置参考:
 * https://cli.vuejs.org/zh/config/
 */
const url = 'http://47.106.171.144:9200'

const pxtorem = require('postcss-pxtorem')

module.exports = {
  lintOnSave: true,
  productionSourceMap: false,
  chainWebpack: (config) => {
    // 忽略的打包文件
    config.externals({
      'vue': 'Vue',
      'vue-router': 'VueRouter',
      'vuex': 'Vuex',
      'axios': 'axios',
      'element-ui': 'ELEMENT',
    })
    const entry = config.entry('app')
    entry
      .add('babel-polyfill')
      .end()
    entry
      .add('classlist-polyfill')
      .end()
  },
  css:{
    loaderOptions: {
      postcss: {
        plugins: [
          pxtorem({
            exclude: /node_modules/i,
            mediaQuery: false,
            rootValue: 75,
            minPixelValue: 0,
            propList: ['*']
          })
        ]
      }
    },
  },

  // 配置转发代理
  devServer: {
    disableHostCheck: true,
    proxy: {
      '/user': {
        target: url,
        ws: true,
        pathRewrite: {
          '^/user': '/user'
        }
      },
    }
  }
}
